package com.jzo2o.customer.controller.agency;

import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditAddReqDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import com.jzo2o.customer.service.IAgencyCertificationService;
import com.jzo2o.mvc.utils.UserContext;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description CertificationAuditController
 * @Author loe
 * @Date 2024-08-14
 */

@RestController("agencyCertificationAuditController")
@RequestMapping("/agency/agency-certification-audit")
@Api(tags = "机构端 - 提交认证接口")
public class CertificationAuditController {

    @Resource
    private IAgencyCertificationService iAgencyCertificationService;

    @PostMapping
    @ApiOperation("机构提交认证申请")
    public void commit(@RequestBody AgencyCertificationAuditAddReqDTO auditAddReqDTO) {
        auditAddReqDTO.setServeProviderId(UserContext.currentUserId());
        iAgencyCertificationService.commit(auditAddReqDTO);
    }

    @GetMapping("rejectReason")
    @ApiOperation("查询最新的驳回原因")
    public RejectReasonResDTO rejectReason() {
        Long userId = UserContext.currentUserId();
        return iAgencyCertificationService.rejectReason(userId);
    }
}
